﻿#!/usr/bin/python

import time, sys
from math import ceil, sqrt, floor

def isprime(num):
    ans = True
    if num <= 1:
        return False
    if num % 2 == 0:
        return False
    for n in xrange(3, int(ceil(sqrt(num)))+1, 2):
        if num % n == 0:
            ans = False
            break
    return ans
    
def factorial(n):
    if n == 1:
        fact = 1
    else:
        fact = n * factorial(n-1)
    return fact
    

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
1  2  3  2  5  3  7  2  3  5   11   2  13       5   